<template>
	<view class="page-section-spacing">
		<imgsBanner :imgList="urllist" :currentImg="currentImg"></imgsBanner>
		<text class="content">{{ content }}</text>
		<view class="tag-view">{{ label }}</view>
		<view class="button-view">
			<button  type="primary" class="handle" hover-class="hover" formType="submit"
			 @click="handle">处理完毕</button>
		</view>
	</view>
</template>

<script>
	import imgsBanner from '../../components/imgsBanner-tag/imgsBanner-tag.vue';
	export default {
		components: {
			imgsBanner
		},
		data() {
			return {
				urllist: [],
				content: '',
				label: '',
				inverted: false,
				currentImg: 0,
				id: ''
			};
		},
		onLoad(e) {
			this.getbanners(e.eventId, e.type);
			this.id = e.eventId;
			// this.handle(e.eventId);
			console.log(this.id);
			console.log(e);
			uni.setStorageSync('eventId', e.eventId);
			uni.setStorageSync('type', e.type);
		},

		methods: {
			getbanners(eventId, type) {
				let that = this;
				console.log(eventId, type);
				uni.request({
					url: this.$serverUrl + '/app/hospital/publicSentiment/findSentimentInfo', //仅为示例，并非真实接口地址。
					data: {
						type: type,
						eventId: eventId
					},
					method: 'POST',
					header: {
						token: uni.getStorageSync('token'),
						'content-type': 'application/json',
						'content-type': 'application/x-www-form-urlencoded'
					},
					success: res => {
						console.log(res.data);


						if (res.data.code == 0) {
							uni.getStorageSync('token', res.data.token);
							if (res.data.data == null) {
								this.currentImg == 0;
								that.urllist = [];
								that.content = null;
								that.label = null;
							} else {
								that.urllist = res.data.data.url.split(',');
								that.content = res.data.data.content;
								that.label = res.data.data.label;
							}

						} else {
							uni.showToast({
								title: res.data.msg,
								duration: 1000
							});
						}
					}
				});
			},
			handle(e) {
				// this.id=eventId;
				console.log(this.id);
				let that = this;
				uni.request({
					url: this.$serverUrl + '/app/hospital/publicSentiment/disposeSentiment', //仅为示例，并非真实接口地址。
					data: {
						eventId: this.id
					},
					method: 'POST',
					header: {
						token: uni.getStorageSync('token'),
						'content-type': 'application/json',
						'content-type': 'application/x-www-form-urlencoded'
					},
					success: (res) => {
						if (res.data.code == 0) {
							uni.showToast({
								title: '处理成功'
							})
						}




					}
				});
			}
		}
	};
</script>

<style>
	.page-section-spacing {
		display: flex;
		flex: 1;
		flex-direction: column;
		min-height: 100vh;
	}

	.swiper {
		height: 750upx;
	}

	/* swiper-item 里面的图片高度 */
	swiper-item image {
		width: 100%;
		height: 750upx;
	}

	.content {
		color: #555555;
		margin: 30upx;
		font-size: 30upx;
		height: ;
	}

	.tag-view {
		/* #ifndef APP-PLUS-NVUE */
		display: flex;
		/* #endif */
		flex-direction: column;
		border-style: solid;
		border-width: 1upx;
		border-color: #0079c3;
		color: #0079c3;
		margin-left: 30upx;
		width: 150upx;
		height: 60upx;
		font-size: 30upx;
		text-align: center;
		justify-content: center;
	}

	.button-view {
		width: 750upx;
		flex-direction: column;
		background-color: #0079c3;
	}

	.handle {
		position: fixed;
		bottom: 0upx;
		width: inherit;
		background-color: #0079c3;
	}
</style>
